package com.example.easycharge.entity;

import com.example.easycharge.notRepEntity.AlertTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
public class Alert {
    @Schema(description = "警报的编号")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long alertId;
    @Schema(description = "警报类型")
    private AlertTypeEnum type;
    @Schema(description = "警报产生时间")
    private Date alertDate;
    @Schema(description = "警报解决时间")
    private Date solveDate;
    @Schema(description = "是否被解决")
    private boolean solved;
    @Schema(description = "警报详情")
    private String alertDetail;

    public Alert(AlertTypeEnum type, String alertDetail) {
        this.alertDate = new Date();
        this.type = type;
        this.alertDetail = alertDetail;
    }
}
